﻿namespace com.crownpack
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class MessageHandler
    {
        #region Fields

        const string BaseUrl = "/_layouts/com.crownpack.initiatives/CustomErrorPage.aspx?e={0}";

        #endregion Fields

        #region Methods

        public static string GetRedirectUrl( string message, params object[ ] args )
        {
            string s = string.Format( message, args );
            return string.Format( BaseUrl, s );
        }

        #endregion Methods

        #region Nested Types

        public class Message
        {
            #region Nested Types

            public class ClientSiteUrl
            {
                #region Fields

                public const string ClientSiteUrlCannotBeChanged = "{0} cannot be changed.";

                #endregion Fields
            }

            public class Connection
            {
                #region Fields

                /// <summary>
                /// The changes were not saved. The connection could not be verified. Reason: The external content type '{0}' could not be accessed. Error: {1} Stack trace: {2} {3}
                /// </summary>
                public const string AccessToExternalContentTypeFailed = "<p>The changes were not saved. The connection could not be verified.</p><h3>Reason:</h3><ul><li>The external content type '{0}' could not be accessed.</li></ul></p><p>Error: {1}</p><p>Stack trace: {2}</p><p>{3}</p>";

                /// <summary>
                /// The changes were not saved. The connection could not be verified. Reason: The external content type '{0}' could not be found. Resolution: Either Verify the name of the external content type Or enter another external content type
                /// </summary>
                public const string ExternalContentTypeNotFound = "<p>The changes were not saved. The connection could not be verified.</p><h3>Reason:</h3><ul><li>The external content type '{0}' could not be found.</li><h3>Resolution:</h3><p>Either<ul><li>Verify the name of the external content type</li><li>Or enter another external content type</li></ul></p>";

                /// <summary>
                /// The changes were not saved. The connection could not be verified. Reason: The parent customer number {1} could not be found using the external content type '{0}'. Resolution: Either Enter another external content type Verify the parent customer number Or enter another parent customer number
                /// </summary>
                public const string ParentCustomerNumberNotFound = "<p>The changes were not saved. The connection could not be verified.</p><h3>Reason:</h3><ul><li>The parent customer number {1} could not be found using the external content type '{0}'.</li><h3>Resolution:</h3><p>Either<ul><li>Enter another external content type</li><li>Verify the parent customer number</li><li>Or enter another parent customer number</li></ul></p>";

                #endregion Fields
            }

            #endregion Nested Types
        }

        #endregion Nested Types
    }
}